import request from '@/utils/request'

/**
 * 用户注册
 * @param {Object} userData - 用户注册数据
 * @param {string} userData.username - 用户名
 * @param {string} userData.email - 邮箱
 * @param {string} userData.password - 密码
 */
export const register = (userData) => {
  return request.post('/auth/register', userData)
}

/**
 * 用户登录
 * @param {Object} credentials - 登录凭据
 * @param {string} credentials.username - 用户名或邮箱
 * @param {string} credentials.password - 密码
 */
export const login = (credentials) => {
  return request.post('/auth/login', credentials)
}

/**
 * 用户登出
 */
export const logout = () => {
  return request.post('/auth/logout')
}

/**
 * 获取当前用户信息
 */
export const getCurrentUser = () => {
  return request.get('/auth/me')
}

/**
 * 刷新token
 * @param {string} refreshToken - 刷新token
 */
export const refreshToken = (refreshToken) => {
  return request.post('/auth/refresh', { refreshToken })
} 